/*-
 * Copyright (c) 2008-2010, Oleg Estekhin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 *  * Neither the names of the copyright holders nor the names of their
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 */

package oe.assertions.predicates;

import org.testng.annotations.DataProvider;

import oe.assertions.DoubleConstants;

public class RelationDataProvider {

    @DataProvider( name = "inputIsEqualToTarget" )
    public static Object[][] inputIsEqualToTarget() {
        Object object = new Object();

        String str1 = "string";
        String str2 = new String( str1 );

        return new Object[][] {
                { null, null },
                { object, object },

                // char
                { 'a', 'a' },

                // string
                { str1, str2 },

                // boolean
                { true, true },
                { false, false },
        };
    }

    @DataProvider( name = "numberIsEqualToTarget" )
    public static Object[][] numberIsEqualToTarget() {
        return new Object[][] {
                // byte
                { ( byte ) 0, ( byte ) 0 },
                { Byte.MAX_VALUE, Byte.MAX_VALUE },
                { Byte.MIN_VALUE, Byte.MIN_VALUE },

                // short
                { ( short ) 0, ( short ) 0 },
                { Short.MAX_VALUE, Short.MAX_VALUE },
                { Short.MIN_VALUE, Short.MIN_VALUE },

                // int
                { 0, 0 },
                { Integer.MAX_VALUE, Integer.MAX_VALUE },
                { Integer.MIN_VALUE, Integer.MIN_VALUE },

                // long
                { 0L, 0L },
                { Long.MAX_VALUE, Long.MAX_VALUE },
                { Long.MIN_VALUE, Long.MIN_VALUE },

                // float
                { 0.0f, 0.0f },
                { 0.0f, -0.0f },
                { -0.0f, 0.0f },
                { -0.0f, -0.0f },
                { 1.0f, 1.0f },
                { Float.MIN_VALUE, Float.MIN_VALUE },
                { Float.MIN_NORMAL, Float.MIN_NORMAL },
                { Float.MAX_VALUE, Float.MAX_VALUE },
                { Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY },
                { Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY },

                // double
                { 0.0, 0.0 },
                { 0.0, -0.0 },
                { -0.0, 0.0 },
                { -0.0, -0.0 },
                { 1.0, 1.0 },
                { Double.MIN_VALUE, Double.MIN_VALUE },
                { Double.MIN_NORMAL, Double.MIN_NORMAL },
                { Double.MAX_VALUE, Double.MAX_VALUE },
                { Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY },
                { Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY },
        };
    }

    @DataProvider( name = "inputIsNotEqualToTarget" )
    public static Object[][] inputIsNotEqualToTarget() {
        return new Object[][] {
                { new Object(), new Object() },
                { new Object(), null },
                { null, new Object() },

                // char
                { 'a', 'b' },
                { 'a', null },
                { null, 'a' },

                // string
                { "a", "b" },
                { "a", null },
                { null, "a" },

                // boolean
                { true, false },
                { false, true },
                { true, null },
                { null, true },
        };
    }

    @DataProvider( name = "numberIsNotEqualToTarget" )
    public static Object[][] numberIsNotEqualToTarget() {
        return new Object[][] {
                // byte
                { ( byte ) 0, ( byte ) 1 },
                { ( byte ) 0, null },
                { null, ( byte ) 0 },

                // short
                { ( short ) 0, ( short ) 1 },
                { ( short ) 0, null },
                { null, ( short ) 0 },

                // int
                { 0, 1 },
                { 0, null },
                { null, 0 },

                // long
                { 0L, 1L },
                { 0L, null },
                { null, 0L },

                // float
                { 0.0f, 1.0f },
                { 0.0f, Float.NaN },
                { Float.NaN, 0.0f },
                { Float.NaN, Float.NaN },
                { 0.0f, null },
                { null, 0.0f },

                // double
                { 0.0, 1.0 },
                { 0.0, Double.NaN },
                { Double.NaN, 0.0 },
                { Double.NaN, Double.NaN },
                { Double.NaN, DoubleConstants.NEGATIVE_NAN },
                { DoubleConstants.NEGATIVE_NAN, DoubleConstants.NEGATIVE_NAN },
                { 0.0, null },
                { null, 0.0 },
        };
    }

    @DataProvider( name = "numberIsLessThanTarget" )
    public static Object[][] numberIsLessThanTarget() {
        return new Object[][] {
                // byte
                { ( byte ) 0, ( byte ) 1 },

                // short
                { ( short ) 0, ( short ) 1 },

                // int
                { 0, 1 },

                // long
                { 0L, 1L },

                // float
                { 0.0f, 1.0f },
                // double
                { 0.0, 1.0 },
        };
    }

    @DataProvider( name = "numberIsGreaterThanTarget" )
    public static Object[][] numberIsGreaterThanTarget() {
        return new Object[][] {
                // byte
                { ( byte ) 2, ( byte ) 1 },

                // short
                { ( short ) 2, ( short ) 1 },

                // int
                { 2, 1 },

                // long
                { 2L, 1L },

                // float
                { 2.0f, 1.0f },
                // double
                { 2.0, 1.0 },
        };
    }

    @DataProvider( name = "inputIsNotCompatibleWithTarget" )
    public static Object[][] inputIsNotCompatibleWithTarget() {
        return new Object[][] {
                // byte
                { ( byte ) 0, ( short ) 0 },

                // short
                { ( short ) 0, 0 },

                // int
                { 0, 0L },

                // long
                { 0L, 0.0f },

                // float
                { 0.0f, 0.0 },

                // double
                { 0.0, ( byte ) 0 },

                // char
                { 'a', "a" },

                // string
                { "a", 0 },

                // boolean
                { false, 0 },
        };
    }

}
